package api.calendar;

import javax.lang.model.util.ElementScanner9;
import java.util.Calendar;
import java.util.Scanner;

/**
 * 获取当前日期
 */
public class CalendarDemo {
    //calender 类是一个抽象类，不能能通过new关键字新建
    //getInstance调yong
    public static void main(String[] args) {
        //键盘录入

        Scanner scanner = new Scanner(System.in);
        System.out.println("years");
        String next = scanner.next();

        //获取Calender
        Calendar instance = Calendar.getInstance();

        //录入
        int i = Integer.parseInt(next);

        //获取三月的最后一天

        instance.set(i,2,1 );
        instance.add(Calendar.DAY_OF_MONTH,-1);

        System.out.println(instance.get(Calendar.DAY_OF_MONTH));


    }








}
